<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="author" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>Document</title>
    <style>
        /* css reset from normalize*/

        html {
            
            /* 1 */
            -ms-text-size-adjust: 100%;
            /* 2 */
            -webkit-text-size-adjust: 100%;
            /* 2 */
        }

        body {
            margin: 0;
        }

        /* 上下拉动滚动条时卡顿、慢 */

        body {
            -webkit-overflow-scrolling: touch;
            overflow-scrolling: touch;
        }

        /* ios和android下触摸元素时出现半透明灰色遮罩 */

        a {
            -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
        }

        #getHeight {
            height: 100vh;
            width: 100vw;
            position: absolute;
            top: 0;
            left: 0;
            z-index: -10;
        }

        #content {
            width: 750px;
            transform-origin: 0 0;
            font-size: 36px;
        }

        #content {
            height: 100%;
        }
        
    </style>
</head>

<body>
    <div id="app">
        <div id="getHeight"></div>
        <div id="content">
            	123
        </div>
    </div>
    <script>
        this.widthBox = window.screen.width
        this.heightBox = window.screen.height
        if (this.widthBox > document.getElementById('getHeight').clientWidth) {
            this.widthBox = document.getElementById('getHeight').clientWidth
        }
        this.showWindowSize()

        function reHeight() {
            console.log(this.heightBox)
            sessionStorage.removeItem('daicanfenappheight')
        }
        function showWindowSize() { // 更改变形
            if (sessionStorage.daicanfenappheight && sessionStorage.daicanfenappheight !== 0) {
                this.heightBox = parseFloat(sessionStorage.daicanfenappheight)
            } else {
                this.heightBox = parseFloat(document.getElementById('getHeight').clientHeight)
                sessionStorage.daicanfenappheight = this.heightBox
            }
            let slace = this.widthBox / 750
            // body
            let BigBox = document.getElementsByTagName('body')[0]
            BigBox.style.width = this.widthBox + 'px'
            BigBox.style.height = this.heightBox + 'px'
            BigBox.style.overflow = 'hidden'
            BigBox.style.maxWidth = '750px'
            // #app
            let AppBox = document.getElementById('app')
            AppBox.style.width = this.widthBox + 'px'
            AppBox.style.height = this.heightBox + 'px'
            AppBox.style.overflow = 'hidden'
            // #content
            let ContentBox = document.getElementById('content')
            let ListArr = [ContentBox]
            // 循环添加属性
            for (let i = 0; i < ListArr.length; i++) {
                ListArr[i].style['transform'] = 'scale(' + slace + ')'
                ListArr[i].style['-ms-transform'] = 'scale(' + slace + ')'
                ListArr[i].style['-moz-transform'] = 'scale(' + slace + ')'
                ListArr[i].style['-webkit-transform'] = 'scale(' + slace + ')'
                ListArr[i].style['-o-transform'] = 'scale(' + slace + ')'
            }
            ContentBox.style['overflow-x'] = 'hidden'
            ContentBox.style['overflow-y'] = 'auto'
            ContentBox.style['height'] = (parseFloat(this.heightBox) / slace) + 'px'
        }
    </script>
</body>

</html>